<?php





namespace app\crm\controller;



use app\admin\controller\ApiCommon;

use app\shop\model\Order as OrderModel;

use app\shop\model\Warehouse as WarehouseModel;

use app\shop\model\Goods as GoodsModel;

use app\shop\model\PayModel as PayModel;

use app\crm\model\Customer as CustomerModel;

use app\crm\model\OutaddcustomerModel;

use Kingdee\Kingdee;

use think\facade\Db;

use think\response\Json;


/**

 * 支付类

 * @package app\shop\controller

 * @author SL

 * @create 2020-06-01

 */

class Outaddcustomer extends ApiCommon
{
    /**

     * 用于判断权限

     * @permission 无限制

     * @allow 登录用户可访问

     * @author SL

     * @create 2021-06-01

     */

    public function initialize()

    {



        $action = [

            'permission' => ['get_submit_zz','get_submit_cq','get_submit_bayu'],

            'allow' => ['export']

        ];

        event('CheckAuth', $action);

        $request = $this->request;

        $a       = strtolower($request->action());

        if (!in_array($a, $action['permission'])) {

            parent::initialize();

        }

    }

    /**

     * 外部链接郑州区域

     * @return Json

     * @author SL

     * @create 2021-06-01

     */

    public function get_submit_zz()

    {

        // echo "<pre>";
        // print_r($this->param);
        // echo "</pre>";

        $request = request()->param();

        $OutaddcustomerModel = new OutaddcustomerModel();

        $data = $OutaddcustomerModel->addData($request);

        if (!$data) {
            return resultArray(['error' => $OutaddcustomerModel->getError()]);
        }
        return resultArray(['error' => $OutaddcustomerModel->getError(), 'data'=>[]]);

    }


    /**

     * 外部链接重庆区域

     * @return Json

     * @author SL

     * @create 2021-06-01

     */

    public function get_submit_cq()

    {

    $request = request()->param();

    $OutaddcustomerModel = new OutaddcustomerModel();

    $data = $OutaddcustomerModel->addDataChongQing($request);

    if (!$data) {
        return resultArray(['error' => $OutaddcustomerModel->getError()]);
    }
    return resultArray(['error' => $OutaddcustomerModel->getError(), 'data'=>$data]);

    }

    // 疤愈
    public function get_submit_bayu()
    {
        $request = request()->param();

        // echo "<pre>";
        // print_r($request);
        // echo "</pre>";
        // exit;

        $OutaddcustomerModel = new OutaddcustomerModel();

        $data = $OutaddcustomerModel->addDataBaYu($request);

        if (!$data) {
            return resultArray(['error' => $OutaddcustomerModel->getError()]);
        }
        return resultArray(['error' => $OutaddcustomerModel->getError(), 'data'=>[]]);
    }

}